<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui" template="/template/template.xhtml"
	xmlns:s="http://sduept.security.el/func">
	<ui:define name="head">
		<link rel="stylesheet"
			href="/resources/plugins/datatables/dataTables.bootstrap.css" />
		<style>
#accountInfo .box-header {
	padding: 19px;
}

#statistics .box-title {
	font-size: 16px;
}

#vol p:nth-child(2) {
	font-size: 15px;
}

select {
	color: black;
}

.ui-autocomplete-input {
	width: 100%;
}
</style>
	</ui:define>
	<ui:define name="content">
		<p:confirmDialog global="true" showEffect="fade" hideEffect="fade">
			<p:commandButton value="是" type="button"
				styleClass="ui-confirmdialog-yes" icon="ui-icon-check" />
			<p:commandButton value="否" type="button"
				styleClass="ui-confirmdialog-no" icon="ui-icon-close" />
		</p:confirmDialog>
		<div class='full-center-content-scroll-noheader'>
			<div class="nav-tabs-custom">
				<div class="tab-content no-padding">
					<div class="chart tab-pane active" id="accountInfo"
						style="position: relative">
						<div class="row">
							<div class="col-md-12 full-content">
								<div class="box box-info">
									<div class="box-body full-content-scroll ">
										<h:form id="form3">
											<p:growl id="msgs" showDetail="true" />
											<p:toolbar id="btnBar">
												<f:facet name="left">
													<p:commandButton value="新增" id="createBtn" style="margin-right:5px"
														rendered="#{s:hasPermission(session,'xtsz_xtgnsz_tqgjsz_xz')}"
														oncomplete="PF('createDlg').show()" process="@this"
														actionListener="#{dataTypeParamController.create}"
														update="form3:createDlg" icon="fa fa-plus" />
													<p:commandButton value="编辑" id="editBtn" style="margin-right:5px"
														rendered="#{s:hasPermission(session,'xtsz_xtgnsz_tqgjsz_bj')}"
														disabled="#{dataTypeParamController.selected.id ==null}"
														oncomplete="PF('createDlg').show()" process="@this"
														actionListener="#{dataTypeParamController.edit}"
														update="form3:createDlg" icon="fa fa-pencil" />
													<p:commandButton value="删除" id="delBtn" style="margin-right:5px"
														rendered="#{s:hasPermission(session,'xtsz_xtgnsz_tqgjsz_sc')}"
														disabled="#{dataTypeParamController.selected.id ==null}"
														actionListener="#{dataTypeParamController.deleteById}"
														update="form3:msgs form3:configTb form3:delBtn form3:editBtn"
														icon="fa fa-trash">
														<p:confirm header="提示" message="确定要删除么？"
															icon="ui-icon-alert" />
													</p:commandButton>
												</f:facet>
											</p:toolbar>
											<p:dataTable id="configTb" var="config" emptyMessage="无记录" scrollable="true" 
												value="#{dataTypeParamController.dataConfigs}" resizableColumns="true"
												rowKey="#{config.id}" rowIndexVar="ite" selection="#{dataTypeParamController.selected}"
												style="margin-bottom:20px;text-align: center">
												<p:ajax event="rowSelectRadio"
													update="form3:delBtn form3:editBtn form3:createBtn configTb" />
												<p:column selectionMode="single" style="width:60px"></p:column>
												<p:column headerText="序号 " style="width:60px;text-align:center">
													<h:outputText value="#{ite+1}" />
												</p:column>
												<p:column headerText="气象预警" style="width:40%;">
													<h:outputText value="#{config.name}" />
												</p:column>
												<p:column headerText="地图图标">
													<p:graphicImage  width="40" height="40" value="#{config.description}"/>
												</p:column>
												<p:column headerText="对应故障">
													<h:outputText value="#{config.reasonType}" />
												</p:column>
												<p:column headerText="对应天气">
													<h:outputText value="#{config.realtimeWeatherType}" />
												</p:column>
											</p:dataTable>
											<p:dialog widgetVar="createDlg" header="#{dataTypeParamController.current.id ==null?'新建':'编辑'}" modal="true"
												id="createDlg" width="750" height="600">
												<p:toolbar>
													<f:facet name="left">
													<p:commandButton id="createSaveBtn" value="保存"
														icon="fa fa-floppy-o"
														update="form3:configTb form3:msgs form3:delBtn form3:editBtn form3:createBtn"
														actionListener="#{dataTypeParamController.save}"
														oncomplete="PF('createDlg').hide()" />
													</f:facet>
												</p:toolbar>
												 <p:panelGrid  cellpadding="5" style="margin-top:10px; width:100%;border:0">
													<p:row>
														<p:column>
															<h:outputText value="天气预警类型" />
														</p:column>
														<p:column colspan="5">
															<h:inputTextarea label="name" rows="2" style="width:100%;"
																value="#{dataTypeParamController.current.name}" />
														</p:column>
													</p:row>
													<p:row>
														<p:column>
															<h:outputText value="原因类型" />
														</p:column>
														<p:column colspan="5">
															<p:selectManyCheckbox layout="grid" columns="3" style="width:100%;"  value="#{dataTypeParamController.selectedReasonType}" >
																<f:selectItems value="#{dataTypeParamController.faultReasons}" ></f:selectItems>         
															</p:selectManyCheckbox >
														</p:column>
													</p:row>
													<p:row>
														<p:column>
															<h:outputText value="地址" />
														</p:column>
														<p:column colspan="3">
															<p:inputText label="desc" id="desc" onclick="PF('treeDialog').show()" style="width:100%;"
																value="#{dataTypeParamController.current.description}"></p:inputText>
														</p:column>
														<p:column colspan="2">
															 <p:graphicImage id="imgshow" width="40" height="40" value="#{dataTypeParamController.current.description}"/>
														</p:column>
													</p:row>
													<p:row>
														<p:column>
															<h:outputText value="天气类型" />
														</p:column>
														<p:column colspan="5">
															<p:selectManyCheckbox layout="grid" columns="3" style="width:100%;"  value="#{dataTypeParamController.selectedWeatherTable}" >
													            <f:selectItems value="#{dataTypeParamController.weatherTables}" var="item" itemValue="#{item.name}" itemLabel="#{item.name}"></f:selectItems>
															</p:selectManyCheckbox >
														</p:column>
													</p:row>
												</p:panelGrid> 
											</p:dialog>
											<p:dialog widgetVar="treeDialog" id="treeDialog" 
												header="选择地址" modal="true" width="400" height="500">
												<p:layout>
													<p:layoutUnit position="north" size="80" style=" width:100%;border:0">
													<p:toolbar >
														<f:facet name="left">
															<p:commandButton value="确定"
																actionListener="#{dataTypeParamController.chooseUrlNode}"
																update="desc imgshow" onclick="PF('treeDialog').hide()" />
														</f:facet>
													</p:toolbar>
													</p:layoutUnit>
													<p:layoutUnit position="center" style=" width:100%;border:0">
														<p:tree value="#{dataTypeParamController.urlRoot}"
															var="item" dynamic="true" animate="true" id="urlTree"
															style=" width:100%;height:400px;border:0;"
															widgetVar="urlTree" selectionMode="single"
															selection="#{dataTypeParamController.selectedUrlNode}">
															<p:ajax event="expand"
																listener="#{dataTypeParamController.onUrlTreeNodeExpand}"
																update="urlTree" />
															<p:treeNode type="root">
																<h:outputText value="#{item}" />
															</p:treeNode>
															<p:treeNode type="other">
																<h:outputText value="#{item}" />
															</p:treeNode>
														</p:tree>
													</p:layoutUnit>
												</p:layout>
											</p:dialog>
										</h:form>
									</div>
									<div class="box-footer"></div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>

	</ui:define>
	<ui:define name="contentend">
		<script src="/resources/plugins/datatables/jquery.dataTables.js"></script>
		<script
			src="/resources/plugins/datatables/dataTables.bootstrap.min.js"></script>
	</ui:define>
</ui:composition>
